Setting the Color of the Curve
Another property of your curve shape object is the reference to its ink object. One of the properties of the ink object is the color property, which contains a data structure that specifies the color that QuickDraw GX should use when drawing the curve.This structure is defined by the
gxColor
data type, which contains three fields:
Color components range from 0 (no intensity) to 0xFFFF (maximum intensity). To set your curve's color to a medium gray, you can use this sample color structure definition and this setting for the color structure's fields:
- The
space
field specifies what color space your color is specified in (such as grayspace, RGB, or CMYK).- The
profile
field specifies color-matching information that QuickDraw GX uses when converting device-independent colors to color-corrected values on a particular output device.- The
element
field is a union specifying the color in terms of the color space. For instance, if you are specifying an RGB color, this field contains color values specifying the red, green, and blue components of the color. Colors in the grayspace color space have a single color component, representing the luminance (from black to white) of the color.
gxColor halfGray; halfGray.space = gxGraySpace; /* color space is grayspace */ halfGray.profile = nil; /* no color-matching */ halfGray.element.gray = 0x8000; /* 50% intensity */Once you have created a color structure, call theGXSetShapeColor
function to copy its information into the color property of the ink object referenced by your curve shape:
GXSetShapeColor(aCurveShape, &halfGray);TheGXSetShapeColor
function works analogously to theGXSetShapePen
function, it
This function affects only the color property of the ink object; no other properties are affected and there are no visible results until you draw the curve.
- finds the ink object referenced by your curve shape's ink property
- copies color information from the
halfGray
color structure into the color property of the ink object
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help